Part Number Hot Search : 
NCV4276A ASI3001 ADL5382 HV7800 C1048 LB1813 ST10R172 F250TA
Product Description
Full Text Search
 

To Download AN1043 Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  AN1043/0301 1/12 AN1043 application note usb suspend and resume modes on the st92163 by microcontroller division introduction in the absence of bus traffic from any powered state for more than 3 ms, all devices that are supplied power via the universal serial bus (usb) must enter suspend mode. bus-powered devices draw current from the usb. these devices must reduce their power consumption to meet usb specifications. for power consumption values, refer to the usb specifications datasheet (version 1.1) (see section 4 ). a device in suspend mode can resume operation when any non-idle signal is received on its upstream port. it can also resume operation from the application via an external interrupt. this application note describes how to configure suspend and resume operations for st92163 microcontrollers. 1
2/12 1 suspend/resume operations setup you have to enable the suspend and end_suspend interrupts to support suspend and resume operations. this can be easily done using the corecfg.exe utility provided by the st92163 usb library. the following figure shows an example of how to use this utility. figure 1. configuring suspend and end_suspend interrupt you have to write the two callback routines associated to suspend and end suspend inter- rupts ( my_suspend_routine and my_resume_routine ) to reduce the power consump- tion of the application board. the corecfg.exe utility generates a config.h file. this file contains the interrupt mask for the usbistr interrupt register that defines the suspend and end_suspend callback routines. refer to the using the st92163 usb library document provided with the st92163 usb li- brary for more details on how to use this utility. figure 2. suspend and end_suspend callback routines note : this code is generated by the corecfg.exe utility . to support resume operations, the wake-up / interrupt lines management unit (wuimu) has to be configured during the initialization phase of the st92163 microcontroller. #define susp_callback my_suspend_routine() #define esusp_callback my_resume_routine() #define imr_msk (int_reset|int_esusp|int_susp) 2
3/12 figure 3. wake-up unit configuration note : this code is included in the st92163 usb library main.c file. 2 suspend management the st92163 usb interface features a dedicated interrupt flag for suspend mode support. when the st92163 must enter suspend mode, the susp ( suspend mode reques t) bit of the usbistr ( interrupt status register ) register is set and an interrupt is generated. note: the suspend condition check is enabled immediately after any usb reset and is disabled by hard- ware when suspend mode is active. 2.1 suspend interrupt routine before entering suspend mode, the application program must configure the application used to reduce power consumption (switch off on-board components, configure i/o ports, ...). you have to perform these operations in the my_suspend_routine routine (see section 1 ). the susp interrupt routine will then switch the usb interface into suspend mode by setting the tim_susp (timed suspen d) bit and then the lp_susp ( low-power suspen d) bit of the usbctlr ( control register ) register. finally, the st92163 cpu clocks are put into low power mode (stop mode) by the susp in- terrupt routine via the wake-up / interrupt lines management unit (wuimu). the following flowchart illustrates the suspend operation. /* wake-up unit configuration*/ spp(wu_pg); wu_ctlr = 0x1; /* set wkup-int and reset id1s bits */ wu_wumrh = 0x80; /* set wum15 bit (to usb i/f) */ wu_wumrl = 0x0; wu_wutrh = 0x80; /* select rising edge for wut15 */ wu_wutrl = 0x0; /* select rising edge for wut7 */ wu_wuprh = 0; /* clear pending bits */ wu_wuprl = 0;
4/12 figure 4. suspend operation flowchart usb suspend do application suspend no wake up event handle usb interrupt do usb suspend stop main loop yes
5/12 figure 5. suspend interrupt routine note : this code is included in the st92163 usb library int92163.c file. #if(imr_msk & int_susp) if (istr & imr & int_susp) { #ifdef susp_callback susp_callback; #endif /* transient suspend */ spp(15); ctlr |= ctr_tim_susp; /* set tim_susp bit of ctlr register */ spp(wu_pg); wu_wuprh = 0; /* clear pending bits */ wu_wuprl = 0; /* lp suspend */ spp(15); ctlr |= ctr_lp_susp; /* enter stop mode*/ spp(wu_pg); wu_ctlr = 0x05;/* set stop and wkup-int bits */ wu_ctlr = 0x01;/* set wkup-int bit */ wu_ctlr = 0x05;/* set stop and wkup-int bits */ nop;nop;nop;nop; spp(15); clear_istr_flag(int_susp); }
6/12 3 resume management the st92163 can resume operation by a signal received via its upstream port, and also by the application via an external interrupt. 3.1 resume from the usb when a non-idle signal is received on its upstream port, an end_suspend (resume) interrupt is generated and the st92163 will resume operations. the end_suspend interrupt routine will then check the on-chip pll locking and resume the st92163 usb interface. the following flowchart illustrates the resume operation. figure 6. resume operation flowchart usb resume do usb resume no handle usb interrupt do application resume main loop yes st9+ pll locked yes no
7/12 figure 7. end_suspend interrupt routine note : this code is included in the st92163 usb library int92163.c file. 3.2 resume from application board to resume operations on the st92163 mcu via an external interrupt by the application, the wake-up / interrupt lines management unit (wuimu) has to be configured. the wuimu wake-up lines are all mapped on the intd1 external interrupt channel. when a wake-up line is enabled, it can wake up the microcontroller. refer to the st92163 datasheet for more details about the wuimu. the following example illustrates the configuration of port 3.7 as the wake-up event source. #if(imr_msk & int_esusp) if (istr & imr & int_esusp) { spp(rccu_pg); while (!(clk_flag & 0x2));/* test pll lock-in */ clk_flag |= 0x1; /* set csu_sel bit */ spp(15); ctlr &= ~ctr_tim_susp; /* clear tim_susp bit of ctlr register */ spp(wu_pg); if (valbit(wu_wuprh, 7)) wu_wuprh &= ~0x80; /* clear pending bit */ #ifdef esusp_callback esusp_callback; #endif spp(15); clear_istr_flag(int_esusp); } #endif
8/12 figure 8. port 3.7 configuration 5v 4.7k ohm s t 9 2 1 6 3 p3.7 5v button
9/12 figure 9. remote wake-up configuration routine note : this code is included in the st92163 usb library main.c file. when the button on port 3.7 is pressed and the st92163 is in stop mode, an external inter- rupt is generated and the mcu wakes up. if the remote wake-up capability is enabled on the device, it will have to propagate a resume signal upstream. the following flowchart illustrates the resume and remote wake-up operations. /* port 3 configuration */ spp(p3c_pg);/*init p3.7 as input cmos*/ p3c0r |= 0x80; p3c1r &= 0x7f; p3c2r &= 0x7f; p3dr= 0xff; /* wake-up unit configuration*/ spp(wu_pg); wu_ctlr = 0x1; /* set wkup-int and reset id1s bits */ wu_wumrh = 0x80; /* set wum15 bit (to usb i/f) */ wu_wumrl = 0x80; /* set wum7 bit (from sw2 button) */ wu_wutrh = 0x80; /* select rising edge for wut15 */ wu_wutrl = 0x80; /* select rising edge for wut7 */ wu_wuprh = 0; /* clear pending bits */ wu_wuprl = 0; /* interrupts configuration */ spp(exint_pg); eitr = 0x80; /* trigger on rising edge for d1 channel */ eipr = 0x0; /* clear pending bits */ eimr = 0x80; /* set external interrupt mask intd1*/ eiplr = 0x7f; /* set external interrupt priority level for channels d1 */ eivr = 0x46; /* set external interrupt vector to 0x40 */
10/12 figure 10. resume and remote wake-up flowchart wuimu pending bit associated to p3.7 set no handle external interrupt do remote wake up main loop yes is st92163 in suspend yes no st9+ pll locked no remote wake up capability yes no do clear wuimu pending bit do application process yes
11/12 figure 11. resume and remote wake-up routine 4 reference documents 1. universal serial bus specification , compaq intel microsoft nec, revision 1.1, september 23, 1998 2. st92163 datasheet, stmicroelectronics, revision 1.9 , january 2000 #pragma interrupt (buttonpressed) void buttonpressed(void) { save_page; spp(wu_pg); if (valbit(wu_wuprl, 7)) /* if sw2 button pressed */ { spp(15); if ((ctlr & (ctr_tim_susp | ctr_lp_susp)) == (ctr_tim_susp | ctr_lp_susp)) { /* if device is in suspend mode */ spp(rccu_pg); while (!(clk_flag & 0x2));/* test pll lock-in */ clk_flag |= 0x1; /* set csu_sel bit */ spp (15); /* mandatory for end */ ctlr &= ~ctr_lp_susp; /* of suspend mode */ asm (nop); ctlr1 = ctr_resume; /* put resume */ wait ( ); /* signal on */ ctlr &= ~ctr_resume; /* usb lines */ istr &= ~int_esusp; /* clear it flag generated by ctr_resume */ } spp(wu_pg); wu_wuprl &= ~0x80; /* clear pending bit */ } restore_page; }
12/12 "the present note which is for guidance only aims at providing customers with information regarding their products in order for them to save time. as a result, stmicroelectronics shall not be held liable for any direct, indirect or consequential damages with respect to any claims arising from the content of such a note and/or the use made by customers of the information contained herein in connexion with their products." information furnished is believed to be accurate and reliable. however, stmicroelectronics assumes no responsibility for the co nsequences of use of such information nor for any infringement of patents or other rights of third parties which may result from its use. no license is granted by implication or otherwise under any patent or patent rights of stmicroelectronics. specifications mentioned in this publicati on are subject to change without notice. this publication supersedes and replaces all information previously supplied. stmicroelectronics prod ucts are not authorized for use as critical components in life support devices or systems without the express written approval of stmicroele ctronics. the st logo is a registered trademark of stmicroelectronics ? 2001 stmicroelectronics - all rights reserved. purchase of i 2 c components by stmicroelectronics conveys a license under the philips i 2 c patent. rights to use these components in an i 2 c system is granted provided that the system conforms to the i 2 c standard specification as defined by philips. stmicroelectronics group of companies australia - brazil - china - finland - france - germany - hong kong - india - italy - japan - malaysia - malta - morocco - sin gapore - spain sweden - switzerland - united kingdom - u.s.a. http://www.st.com


▲Up To Search▲   

 
Price & Availability of AN1043

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X